package com.news.cloud.jpa.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import java.sql.Timestamp;

/**
 * Created by hiephn on 2014/08/28.
 */
@Entity
public class Feed extends NameDescPersistable {

    @Column(length = 128)
    private String providerFeedId;
    @Column
    private Timestamp pubDate;
    @Column
    private Timestamp lastUpdate;
    @Column(length = 256)
    private String link;
    @Column(length = 256)
    private String imgUrl;
    @Column(length = 45)
    private String author;
    @Column
    private int minRead;
    @Column
    private int hot;
    @Column
    private int likeNo;
    @Column
    private int shareNo;
    @Column
    private int commentNo;

    // Not a column, used for sorting
    @Transient
    private int weight;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "channel_id")
    private Channel channel;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "provider_id")
    private Provider provider;

    public String getProviderFeedId() {
        return providerFeedId;
    }

    public void setProviderFeedId(String providerFeedId) {
        this.providerFeedId = providerFeedId;
    }

    public Timestamp getPubDate() {
        return pubDate;
    }

    public void setPubDate(Timestamp pubDate) {
        this.pubDate = pubDate;
    }

    public Timestamp getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Timestamp lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getMinRead() {
        return minRead;
    }

    public void setMinRead(int minRead) {
        this.minRead = minRead;
    }

    public int getHot() {
        return hot;
    }

    public void setHot(int hot) {
        this.hot = hot;
    }

    public int getLikeNo() {
        return likeNo;
    }

    public void setLikeNo(int likeNo) {
        this.likeNo = likeNo;
    }

    public int getShareNo() {
        return shareNo;
    }

    public void setShareNo(int shareNo) {
        this.shareNo = shareNo;
    }

    public int getCommentNo() {
        return commentNo;
    }

    public void setCommentNo(int commentNo) {
        this.commentNo = commentNo;
    }

    public Channel getChannel() {
        return channel;
    }

    public void setChannel(Channel channel) {
        this.channel = channel;
    }

    public Provider getProvider() {
        return provider;
    }

    public void setProvider(Provider provider) {
        this.provider = provider;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }
}
